<template>
  <!-- 放置一个图标 -->
  <div>
    <svg-icon :icon-class="isScreenFull?'exit-fullscreen':'fullscreen'" class="fullscreen" @click="toggleScreenFn" />
  </div>
</template>

<script>
import screenFull from 'screenfull'
export default {
  name: 'ScreenFull',
  data() {
    return {
      isScreenFull: false
    }
  },
  created() {
    screenFull.on('change', () => {
      this.isScreenFull = screenFull.isFullscreen
    })
  },
  methods: {
    toggleScreenFn() {
    //   this.isScreenFull = !this.isScreenFull
      screenFull.toggle()
    }
  }
}
</script>

  <style lang="scss" scoped>
  .fullscreen {
    width: 20px;
    height: 20px;
    color: #fff;
    cursor: pointer;
  }
  </style>

